import React ,{ useState } from 'react'
import TestBox from '../Test/TestBox'
import {Input} from 'antd';
 function Index() {
   const { Search } = Input;
   // const testDetail={"testForm":"1","stem":"<p style=''><span style=\"font-size: 14px;font-family: 宋体;\" >She’s buying things ____your birthday .</span></p>","courseTestChooseAnwser":[{"optionName":"A","memo":"<span style=\"\" >for</span>"},{"optionName":"B","memo":"<span style=\"\" >to</span>"},{"optionName":"C","memo":"<span style=\"\" >in</span>"}]};
   const btnFlag = false;
   const attr = "";

   const [testDetail, setTestDetail] = useState({});
   const addTodo = (item) => {
    //   let Detail='{"testForm":"3","stem":"<p><span>'+item+'</span></p>","courseTestChooseAnwser":[{"optionName":"A","memo":"<span>for</span>"},{"optionName":"B","memo":"<span>to</span>"},{"optionName":"C","memo":"<span>in</span>"}]}';    
    
      return setTestDetail(item && JSON.parse(item));
   };

   return (
     <header className="main">
       <Search
         placeholder="点击生成"
         allowClear
         enterButton="点击生成"
         style={{ width: "1000px" }}
         onSearch={addTodo}
       />

       {testDetail && (
         <TestBox
           testDetail={testDetail}
           flag={btnFlag}
           attr={attr}
           index={-1}
         />
       )}
     </header>
   );
 }
export default  Index;